<%= simple_form_for [:admin, @terminal_group], :defaults => { :input_html => { :class => "form-control" } }, remote: true, html: {class: 'form-horizontal' } do |f| %>
	<fieldset>
		<legend><%= title %></legend>
	  <%= f.association :city, label: '城市'  %>
	  <%= f.input :industry, label: '行业类型', prompt: '请选择', :input_html => { class: "" }  %>
		<%= f.input :group_name, label: '设备组名称' %>
	  <%= f.input :description, label: '描述' %>
	  <%= f.input :terminal_ids, :as => :grouped_select, label: '终端', :collection => [['移动版', Terminal.by_name('yidong').order('terminal_group_id desc')], ['加强版', Terminal.by_name('zengqiang').order('terminal_group_id desc')]], :group_method => :last, :input_html => { class: "", multiple: true } %>
	  <%#= f.association :terminals, collection: Terminal.order('terminal_group_id desc').all, checked: @terminals, label: '终端', :input_html => { class: "" }  %>
	  <% if params[:action] == 'edit' %>
	  	<%= f.button :wrapped, value: '提 交', :confirm => "Are you sure?"  %>
	  <% else %>
	  	<%= f.button :wrapped, value: '提 交' %>
	  <% end %>
  </fieldset>
<% end %>
<%= javascript_tag do %>
	$('#terminal_group_terminal_ids').select2({width: "100%"});
<% end %>
<% 
  tags = TerminalGroup.uniq.pluck('industry').compact
%>
<%= javascript_tag do %>
  $('#terminal_group_industry').select2({tags:<%= tags.to_s.html_safe %>,  maximumSelectionSize: 1, width: "100%" });
<% end %>
<%= javascript_include_tag "prevent_label.js" %>